# Contributor: Sean McAvoy <seanmcavoy@gmail.com>
# Maintainer: Sean McAvoy <seanmcavoy@gmail.com>
pkgname=py3-ansible-compat
pkgver=2.1.0
pkgrel=0
pkgdesc="functions that help interacting with various versions of Ansible"
url="https://github.com/ansible-community/ansible-compat"
arch="all"
license="MIT"
depends="python3 py3-subprocess-tee py3-yaml"
makedepends="
	ansible-core
	py3-tox
	py3-build
	py3-setuptools_scm
	py3-setuptools
	py3-installer
	py3-wheel
	py3-pep517"
checkdepends="py3-pytest py3-flaky py3-pytest-mock"
#subpackages="$pkgname-doc"
source="ansible-compat-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/a/ansible-compat/ansible-compat-$pkgver.tar.gz"
builddir="$srcdir/ansible-compat-$pkgver"
# the tests don't clean up after themselves, and fail if something is left in
# /tmp, and every release they add even more broken tests like this
options="!check"

build() {
	python3 -m build --wheel --skip-dependency-check --no-isolation
}

check() {
	# FIXME: bad tests leave around state and fail on builders
	# on subsequent runs
	PYTHONPATH="$builddir/build/lib:$PYTHONPATH" pytest -v \
		-k "not test_runtime_install_role and not test_install_galaxy_role"
}

package() {
	python3 -m installer --destdir="$pkgdir" --compile-bytecode 0 \
		dist/*.whl
}

sha512sums="
a85681aff3d34ef4a4cdad8f419017a174bf315034495bc032a7e33d586cbcf72de74d163b6faf3cd21988704e5dbb922872b83a23981891311dbb18e53797a3  ansible-compat-2.1.0.tar.gz
"
